<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <title>批量导入用户</title>
    <link rel="stylesheet" href="../layui/css/layui.css"/>
    <link rel="stylesheet" href="../css/admin.css"/>
    <style>
    .layui-form{
        width: 330px;
        height:46px;
        margin:0 auto;
    }
    .add-person th{
        width:96px;
        height:40px;
        margin-left:10px;
        font-size:14px;
        padding: 0;
        vertical-align: middle;
    }
    .add-person input{
        outline:none;
        width:100px;
        height: 28px;
        border:1px solid #E5BA70;
        border-radius:5px;
    }
    .add-person td{
        position: relative;
    }
    .layui-form .layui-table{
        margin-top:50px;
        margin:0 auto;
    }
    #choice{
        width:180px;
        margin-top:10px;
        margin-bottom:20px;
    }
    #btn-c{
        border:0;
        margin-top: 5px;
        margin-left:74px;
        width: 178px;
        height: 28px;
        border-radius:5px;
        background-color: #D8D8D8;
    }
    #btn-c:hover,#btn-s:hover{
        color:#fff;
        background-color:#EF7632;
     }
    #btn-s{
        display:inline-block;
        margin-left:0px;
        width:178px;
        height:28px;
        border-radius:5px;
        border:0px;
        outline:none;
    }
    .layui-layer .layui-layer-title{
        background-color: #fff;
    }
    .layui-upload-button{
        margin-left:74px!important;
        height:32px;
        width:178px;
        border:none;
        outline:none;
        line-height:32px;
    }
    .layui-upload-button:hover{
        border:none;
        outline:none;
    }
    .layui-upload-icon{
    }
    </style>
</head>
<body>
     <form class="layui-form" action="">
            <table class="layui-table layui-table-add" lay-skin="nob">
              <tbody>
              <tr class="add-person">
                  <th>下载模板</th>
                  <td><a href="http://wrench-tida.tunnel.echomod.cn/moudle.xls">点击此处下载模板</a></td>
              </tr>
              </tbody>
            </table>
      </form>
    <div class="layui-container">
        <div class="layui-row" align="center" style="margin-top: 30px;">
            <button type="button" class="layui-btn" id="upload">
                <i class="layui-icon">&#xe67c;</i>选择文件</button>
        </div>
        <div class="layui-row" align="center" style="margin-top: 20px;">
<!--             <textarea id="result" cols="20" rows="10"></textarea> -->
           <span id="result"></span>
        </div>
    </div>
    <script type="text/javascript" src="../layui/layui.js"></script>
    <script type="text/javascript" src="../layui2/layui.all.js"></script>
    <script src="../js/jquery.min.js"></script>
    <script>
    layui.use('upload', function(){
        var upload = layui.upload;


        var danyuan_id =localStorage.getItem("danId");
            console.log(danyuan_id);
        //执行上传
        var uploadInst = upload.render({
            elem: '#upload' //绑定元素
            ,url:  '../../organization_manage/batchInputUser' //上传接口
            ,method: 'POST'
            ,accept: 'file'
            ,size: 50
            ,before: function(obj){
                layer.load();
                this.data={
                   danyuan_id:danyuan_id,
                }
                console.log(this.data);
            }
            ,done: function(res){//上传完毕回调
                layer.closeAll('loading');

                var result = '';
                for(var i=0; i<res.length; i++){
                    result = result + res[i].nsrsbh+"="+res[i].container+"\n";
                }
                $("#result").html(result);
                alert("文件上传成功");
            }
            ,error: function(){//请求异常回调
                layer.closeAll('loading');
                layer.msg('网络异常，请稍后重试！');
            }
        });
    });
</script>
</body>
</html>
